The present invention relates to a high efficiency coding method of a moving video image signal and, more particularly, to a coding compression method which is appropriate for a storage media such as an optical disk.
Generally, when the video image data is stored as it is, it requires a memory of a tremendously large capacity Accordingly, a technology of storing video image data in a media with efficiently compressing the video image data becomes that of a great importance.
On the other hand, from an optical disk, usually, video image data of constant rate is reproduced as seen in CD or LD. However, there are generally a video image of a scene including a large quantity of information and a video image of a scene including not so large quantity of information As a coding method effectively utilizing this nature of video image, there is proposed a variable bit rate coding method (as disclosed in Japanese laid-open publication No. Hei. 7-284097).
At first, a video image coding circuit which is generally used in MPEG will be described with reference to FIG. 13. The coding circuit 2 in FIG. 13 compresses data using the motion compensation DCT method. The motion compensation DCT method is a method of transmitting one frame which is periodically selected from the input video image with compressing the same by using only the data in that frame, and transmitting the remaining frame with compressing the difference between that frame and the previous frame. For the intra-frame compression and inter-frame compression, a discrete cosine transform as a kind of orthogonal base transformation is employed. In addition, when calculating the difference between frames, detecting the motion vector of the video image among the previous frames, and taking the difference after the motions being corrected, whereby the compression rate is enhanced to a great extent.
Hereinafter, the operation of the coding circuit 2 in FIG. 13 will be described in more detail. In FIG. 13, the real lines show flows of data, and dotted lines show flows of control.
The video image data input from the input terminal 30 is stored in the frame buffer 25, and thereafter, reordered in the coding order by the frame reordering circuit 26. The subtracter 10 is used for calculating the difference from the previous frame. The coding control circuit 22 controls the on and off of the refresh switches 23 and 24 in accordance with the type of the pictures to be processed. In other words, the coding control circuit 22 switches of f the refresh switches 23 and 24 (performs in-frame compression) when the pictures to be processed are I pictures (intra-pictures). As a result, the subtracter 10 will not operate.
The input video image data is DCT converted by the DCT conversion circuit 11. The DCT is usually performed two-dimensionally. When the DCT is to be performed for each 8xc3x978 blocks, it results in 8xc3x978 pieces of coefficients. The data to which DCT is performed is originally continuous quantity, but because the operation is performed using digital circuits, 64 pieces of coefficients are obtained as digital values of a predetermined bit width. This data is subjected to appropriate bit allocation for each frequency component by a quantization circuit 12. In general, low band component is subjected to a large number of bit allocation because low band component is important for constituting a video image, and high band component is subjected to a small number of bit allocation because high band component is not so important for constituting a video image. A variable length coding (VLC) circuit 13 performs variable length coding of the output of the quantization circuit 12. The variable length coding is a method of allocating a shorter code length to data, which has statistically higher appearance probability, and this method enables to remove the statistically redundant component included in the data. In this method, Huffmann code is often used.
An inverse quantization circuit 15 reverses the quantization of the output of the quantization circuit 12. In contrast to the quantization, the inverse quantization circuit 15 restores the amplitude of each frequency component. Each coefficient restored to the original amplitude by the inverse quantization circuit 15 is restored to the original video image data by the inverse DCT circuit 16. When the restored video image data is intra-frame video image data, an adder 17 will not operate. Thereafter, the restored video image data is delayed by a predetermined number of frames by a frame memory 18. The delayed video image data is input to a motion vector detecting circuit 20. The motion vector detecting circuit 20 calculates a motion amount from the input video image data. A motion compensation circuit 19 moves the place of the video data image in accordance with the motion amount. Thus, the video image data subjected to a motion compensation is used to calculate the difference from the next video image data by the subtracter 10.
The video image of some frames followed by I picture are used for compressing the difference from the video image data of the former frame. A coding control circuit 22 switches the refresh switch 23 or 24 on in case where the picture to be processed is P picture or B picture (intra-frame compression). The refresh switch 23 is switched on in calculating the difference between frames and is used for operating the subtracter 10.
The refresh switch 24 is repeatedly switched on or off alternatively with the refresh switch 23 at a predetermined period. When it is switched on, it is used to operate adder 17 to add the different data between the frames and the former frame data, and is used to restore the frame. A variable length coding circuit 13 also performs the variable length coding to the inter-frame compression data.
Here, a group from I picture before the next I picture is called 1 GOP (Group of Picture), and it is usually constituted from the video image signal having about 15 frames (about 0.5 second).
The output of a variable length coding circuit (VLC) 13 is output through the buffer circuit 14 to an output terminal 31. The quantization scale decision circuit 21 indicates, viewing the state of the buffer circuit 14, a quantization scale to the quantization circuit 12. To be specific, when it is assumed that a video image signal is output from the buffer circuit 14 at a prescribed constant rate, when the data left in the buffer circuit 14 is small, it is necessary to generate a large amount of data, and therefore, the quantization scale Q is controlled to be smaller than before, thereby to increase the number of the generated bit amount. On the contrary, when the data left in the buffer circuit 14 is too large, it is necessary to make it difficult to generate data, and therefore the quantization scale Q is controlled to become larger than before, thereby to decrease the number of generated bit.
To be specific, the target data amount which is a data amount to be generated in the next section is calculated from the buffer residual quantity, and then the quantization scale is calculated from the target data amount. When the target data amount is large, the quantization scale Q is required to be small, while when the target data amount is small, the quantization scale Q large. In short, the target data amount and the quantization scale are in a relation of inverse proportion.
The target data amount for each section of the video image signal is calculated in advance to be stored in the quantization scale decision circuit 21, and the target data amount is compulsorily and successively changed for each short section while performing coding, whereby a variable bit rate control is realized,
In FIG. 14, the description of the variable bit rate control of two-path system, which is usually employed, is given. The first path inputs the prescribed video image signal such as 2 hours video image signal from the terminal 1, and then performs the first coding in the coding circuit 2. The coding circuit 2 is the same as that in the FIG. 2, while the feedback loop from the buffer circuit 14 to the quantization circuit 12 is omitted. To be specific, regardless that of the generated data amount is large or small, the quantization scale Q1 decided in the quantization scale decision circuit is made at a fixed value. However it may be fixed independently for each picture.
The generated data amount D1 resulted therefrom is stored in a storage circuit 3 for each short section such as for each 2 GOP. Examples of the generated data amount D1 and the target data amount D2, are shown as a simple model in FIG. 15(A) and (B).
The abscissa represents GOP and the ordinate represents the generated data amount. Section A shows a standard video image, Section B shows a video image having a small amount of motions, which is easy to be coded, and Section C shows a video image of a large amount of motions, which is difficult to be coded. When assumed that the time length of each section is one third of the whole time length, the ratio between the sum of the generated data amount D1 generated in each section becomes A:B:C=2:1:3. Here, while the value on the ordinate itself depends on the quantization scale Q1, in the present invention, the relative ratios between respective sections are more important than the value on the ordinate itself.
In case where the whole capacity of an optical disk, DALL is considered as 3-gigabyte, the allocated amount to the section A is calculated as 3-gigabyte/6xc3x972=1-gigabyte. In the same way, the section B is calculated as 0.5-gigabyte and the section C is calculated as 1.5-gigabyte.
In general, in case where the generated data amount of the short section which is generated in the first path is regarded as D1, the sum of the data amount D1 is xcexa3D1, the target data amount as D2, and the whole capacity as DALL, the target data amount D2 of each section is calculated by D2=D1xc3x97DALL/xcexa3D1.
Thus, it can be easily performed by the calculation to divide the video image signal such as 2 hours video image signal in short sections of each 2 GOP (1 second), and allocate the same such that each target data amount D2 should be approximately in proportion to the generated data amount D1 stored in said storage circuit 3 and that the sum of each target data amount D2 be the whole sum of the optical disk, DALL.
The target data amount decision circuit 4 in FIG. 14, thus calculates the target data amount based on the information of the generation code amount storage circuit 3. The target data amount of each short section decided in the target data amount decision circuit 4 is stored in the target data amount storage circuit 5.
Next, in the second path, the same video image signal of the first path is input from the terminal 1 in FIG. 14 and coding is performed Thus, a target data amount storage circuit 5 feeds the target data amount calculated in advance to a coding circuit 2a. The coding circuit 2a, which is almost same as that in FIG. 13, is constructed such that a quantization scale decision circuit 21 can receive the instruction from the target data amount storage circuit 5.
With such construction, the code amount is allocated to each section in accordance with the difficulty of coding for respective short sections detected in the first coding, and therefore a coding with compression appropriate for a storage media is realized.
The above-described prior art is a method for efficiently recording the moving video image data in a storage media such as an optical disk by the variable bit rate control. However it is difficult to perform optimum coding in consideration of human visual characteristic only with the information concerning input video image obtained by the first coding as well as the target coding compression condition calculated automatically from the result of the first coding. In addition, there is a problem that coding itself requires a lot of time and expense since at least twice codings are required. Further, when some faults such as errors due to dropouts are found partially in the input video image signal after the coding, re-coding of whole video image signal already coded is also required, resulting in a large inefficiency.
According to a first aspect of the present invention, a first coding is performed by variable bit rate control, the target coding compression condition which is obtained from the result of the first coding is edited, and a second coding is performed on the basis of the edited target coding compression condition, thereby resulting in coding in consideration of human visual characteristics and psychological characteristics.
Therefore, it is also possible to improve the whole coding efficiency to a large extent since second coding is performed only to partial sections where the target coding compression condition is edited.
According to the second aspect of the present invention, when the GOP structure and the inverse television-cinema conversion structure of the target coding condition are changed, the target generation code amount in the second coding is adaptively predicted from the target coding condition before and after the changes thereof, whereby the optimum coding allocation is realized, and the quality of the video image is improved.